﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ComplexModelController.cs" company="">
//   
// </copyright>
// <summary>
//   The complex model controller.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace BuildJavascriptModelDemo.Controllers
{
    using System.Web.Mvc;

    using BuildJavasciptDataModel_Test.DataModels;

    using BuildJavascriptDataModel;

    /// <summary>
    /// The complex model controller.
    /// </summary>
    public class NestedModelController : Controller
    {
        #region Public Methods

        /// <summary>
        /// The get model.
        /// </summary>
        /// <returns>
        /// </returns>
        [HttpPost]
        public JsonResult GetModel()
        {
            var b = new NestModelNestedClass
                {
                    CheckBoxTest = false,
                    IntegerTest = 88
                };

            var c = new NestedModel
                {
                    NestModelSet = b,
                    SimpleProperty = "Something that means something",
                    IntProperty = 42
                };
            return Json(c);
        }

        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// </returns>
        public ActionResult Index()
        {
            return this.View(new NestedModel());
        }

        #endregion
    }
}